package com.ruoyi.appService.CollegeStudents.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.appService.huoland.domain.ZTestHuoland;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.appService.CollegeStudents.domain.ZCollegeStudents;
import com.ruoyi.appService.CollegeStudents.service.IZCollegeStudentsService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 大学生心理健康量表Controller
 * 
 * @author yuqihe
 * @date 2025-05-16
 */
@CrossOrigin
@RestController
@RequestMapping("/CollegeStudents/Students")
public class ZCollegeStudentsController extends BaseController
{
    @Autowired
    private IZCollegeStudentsService zCollegeStudentsService;

    /**
     * 查询大学生心理健康量表列表
     */
    @PreAuthorize("@ss.hasPermi('CollegeStudents:CollegeStudents:list')")
    @GetMapping("/list")
    public TableDataInfo list(ZCollegeStudents zCollegeStudents)
    {
        startPage();
        List<ZCollegeStudents> list = zCollegeStudentsService.selectZCollegeStudentsList(zCollegeStudents);
        return getDataTable(list);
    }

    //查询全部试题
    @GetMapping("/listAll")
    public TableDataInfo listAll(ZCollegeStudents zCollegeStudents)
    {
        List<ZCollegeStudents> list = zCollegeStudentsService.selectZCollegeStudentsList(zCollegeStudents);
        return getDataTable(list);
    }

    /**
     * 导出大学生心理健康量表列表
     */
    @PreAuthorize("@ss.hasPermi('CollegeStudents:CollegeStudents:export')")
    @Log(title = "大学生心理健康量表", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ZCollegeStudents zCollegeStudents)
    {
        List<ZCollegeStudents> list = zCollegeStudentsService.selectZCollegeStudentsList(zCollegeStudents);
        ExcelUtil<ZCollegeStudents> util = new ExcelUtil<ZCollegeStudents>(ZCollegeStudents.class);
        util.exportExcel(response, list, "大学生心理健康量表数据");
    }

    /**
     * 获取大学生心理健康量表详细信息
     */
    @PreAuthorize("@ss.hasPermi('CollegeStudents:CollegeStudents:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(zCollegeStudentsService.selectZCollegeStudentsById(id));
    }

    /**
     * 新增大学生心理健康量表
     */
    @PreAuthorize("@ss.hasPermi('CollegeStudents:CollegeStudents:add')")
    @Log(title = "大学生心理健康量表", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ZCollegeStudents zCollegeStudents)
    {
        return toAjax(zCollegeStudentsService.insertZCollegeStudents(zCollegeStudents));
    }

    /**
     * 修改大学生心理健康量表
     */
    @PreAuthorize("@ss.hasPermi('CollegeStudents:CollegeStudents:edit')")
    @Log(title = "大学生心理健康量表", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ZCollegeStudents zCollegeStudents)
    {
        return toAjax(zCollegeStudentsService.updateZCollegeStudents(zCollegeStudents));
    }

    /**
     * 删除大学生心理健康量表
     */
    @PreAuthorize("@ss.hasPermi('CollegeStudents:CollegeStudents:remove')")
    @Log(title = "大学生心理健康量表", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(zCollegeStudentsService.deleteZCollegeStudentsByIds(ids));
    }




}
